﻿
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace Conquest.Right
{
    /// <summary>
    /// Description of MapView.
    /// </summary>
    public partial class MapView : UserControl
    {
        public struct DataClass
        {
            public DataClass(
                string name, int x, int y,
                int first, int second, int third)
            {
                this.name = name;
                this.x = x;
                this.y = y;
                this.first = first;
                this.second = second;
                this.third = third;
            }
            
            public string name;
            public int x;
            public int y;
            public int first;
            public int second;
            public int third;
        }
        
        private DataClass[] _Data = new DataClass[]
        {
            new DataClass("New Castle", 270, 250, 6, 4, 2),
            new DataClass("Old Castle", 200, 700, 7, 3, 1),
            new DataClass("Betic", 500, 1000, 5, 2, 1)
        };
        
        public MapView()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();
            
            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
            AdjustSize();
            CreateCityStates();
        }
        
        private void CreateCityStates()
        {
            foreach (DataClass data in _Data) 
            {
                NamedCityState city = new NamedCityState();
                city.StateName = data.name;
                city.Location = new Point(data.x, data.y);
                city.First = data.first;
                city.Second = data.second;
                city.Third = data.third;
                panel2.Controls.Add(city);
            }
        }
        
        private void AdjustSize()
        {
            Image image = this.panel2.BackgroundImage;
            this.panel2.Width = image.Width;
            this.panel2.Height = image.Height;
        }
    
        public Panel GroupBox
        {
            get { return panel2; }
        }
        
        void Panel2MouseMove(object sender, MouseEventArgs e)
        {
            _LocationLabel.Text = "" + e.Location;
        }
        
        void Panel2MouseDown(object sender, MouseEventArgs e)
        {
            _LocationLabel.Text = "" + e.Location;
        }
    }
    
}
